"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
  name: "timer",
  props: {
    auto: {
      type: Boolean,
      default: true
    }
  },
  watch: {
    Number: function(val) {
      this.countDown1 = this.Number;
      this.countDown(this.Number);
      this.$emit("timing", this.Number);
    }
  },
  created() {
    if (this.auto) {
      this.interval = setInterval(() => {
        this.Number++;
      }, 1e3);
    }
  },
  data() {
    return {
      Number: 0,
      minutes: 0,
      minutes1: 0,
      second: 0,
      second1: 0,
      countDown1: 0,
      interval: null
    };
  },
  methods: {
    reset() {
      clearInterval(this.interval);
      this.Number = 0;
      this.minutes = 0;
      this.minutes1 = 0;
      this.second = 0;
      this.second1 = 0;
      this.countDown1 = 0;
      this.interval = setInterval(() => {
        this.Number++;
      }, 1e3);
    },
    start() {
      this.interval = setInterval(() => {
        this.Number++;
      }, 1e3);
    },
    clear() {
      clearInterval(this.interval);
    },
    countDown(countDown) {
      if (countDown > 59) {
        let d = parseInt(countDown / 60);
        let minute = d.toString().split("");
        if (minute.length == 1) {
          this.minutes = minute[0];
          this.minutes1 = 0;
        } else {
          this.minutes1 = minute[0];
          this.minutes = minute[1];
        }
        let dd = countDown % 60;
        let numbers = dd.toString().split("");
        if (numbers.length == 1) {
          this.second1 = 0;
          this.second = numbers[0];
        } else {
          this.second1 = numbers[0];
          this.second = numbers[1];
        }
      } else {
        this.minutes = 0;
        this.minutes1 = 0;
        let numbers = countDown.toString().split("");
        if (numbers.length == 1) {
          this.second = numbers[0];
          this.second1 = 0;
        } else {
          this.second1 = numbers[0];
          this.second = numbers[1];
        }
      }
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return {
    a: common_vendor.t($data.minutes1),
    b: common_vendor.t($data.minutes),
    c: common_vendor.t($data.second1),
    d: common_vendor.t($data.second)
  };
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-86b58fd3"], ["__file", "D:/Project/heart-3.0/heart-field-3.0/uni_modules/smh-timer/components/smh-timer/smh-timer.vue"]]);
wx.createComponent(Component);
